import { Space, Table} from 'antd';
import React from 'react';
import axios from 'axios';
import { useState } from 'react';
import AddCount from './addCount';
import 'antd/dist/antd.min.css';
import './basePrice.css'
  
    export default function Rules() {
      const columns = [
        {
          title: '计算方案名称',
          dataIndex: 'name',//'countName',
          key: 'name',
        },
        {
          title: '创建人',
          dataIndex: 'founder',
          key: 'founder',
        },
        {
          title: '创建日期',
          dataIndex: 'createDate',
          key: 'createDate',
        },
        {
          title: '方案状态',
          dataIndex: 'planState',
          key: 'planState',
        },
        {
          title: '操作',
          key: 'action',
          render: (_, record) => (
            <Space size="middle">
              <a>查看详情</a>
            </Space>
          ),
        },
      ];
      // 在函数式组件里面使用useSate来定义了数据 []就是初始值 setDate是在给data赋值时使用
      let [data,setDate]=useState([]);

      axios.get('',{
    params:{
      pagesize:10,
      pagenum:1,
    }
  })
    .then(response=> {
      let data = response.data;
      setDate(data)
    })
    .catch(function (error) {
      console.log(error);
    })
  
  
      return(
        <>
        <AddCount/>
      <Table columns={columns} dataSource={data} className="tb"/></>
      
      )
  }